﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	mc:Ignorable="d"
	x:Class="PearTunes.MusicInfo"
	x:Name="UserControl"
	d:DesignWidth="404" d:DesignHeight="53">
    <UserControl.Resources>
        <SolidColorBrush x:Key="TextForegoundColor" Color="#FF4E5045"/>
        <LinearGradientBrush x:Key="SliderBackground" EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#FF787C66" Offset="0"/>
            <GradientStop Color="#FFA9AC96" Offset="1"/>
            <GradientStop Color="#FFA5A893" Offset="0.022"/>
            <GradientStop Color="#FFC2C5B1" Offset="0.966"/>
        </LinearGradientBrush>
        <Style x:Key="ThumbStyle" d:IsControlPart="True" TargetType="{x:Type Thumb}">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="Height" Value="14"/>
            <Setter Property="Width" Value="14"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Grid>
                            <Ellipse x:Name="Ellipse" Fill="{DynamicResource NormalBrush}" Stroke="{DynamicResource NormalBorderBrush}" StrokeThickness="1"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="Ellipse"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Fill" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Ellipse"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="SliderStyle" TargetType="{x:Type Slider}">
            <Setter Property="Background" Value="{DynamicResource LightBrush}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Slider}">
                        <Grid x:Name="GridRoot">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <!-- TickBar shows the ticks for Slider -->
                            <TickBar Visibility="Collapsed" x:Name="TopTick" Height="4" SnapsToDevicePixels="True" Placement="Top" Fill="{DynamicResource GlyphBrush}"/>
                            <Border Grid.Row="1" Margin="0" x:Name="Border" Height="8" Background="{DynamicResource SliderBackground}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" BorderBrush="{DynamicResource SliderBackground}"/>

                            <!-- The Track lays out the repeat buttons and thumb -->
                            <Track Grid.Row="1" x:Name="PART_Track">
                                <Track.Thumb>
                                    <Thumb Style="{DynamicResource ThumbStyle}" Width="10" Height="10" Background="White" Foreground="White"/>
                                </Track.Thumb>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="Slider.IncreaseLarge"/>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="Slider.DecreaseLarge"/>
                                </Track.DecreaseRepeatButton>
                            </Track>

                            <TickBar Visibility="Collapsed" Grid.Row="2" x:Name="BottomTick" Height="4" SnapsToDevicePixels="True" Placement="Bottom" Fill="{TemplateBinding Foreground}"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="TickPlacement" Value="TopLeft">
                                <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
                            </Trigger>
                            <Trigger Property="TickPlacement" Value="BottomRight">
                                <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
                            </Trigger>
                            <Trigger Property="TickPlacement" Value="Both">
                                <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
                                <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
                                <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
                            </Trigger>

                            <!-- Use a rotation to create a Vertical Slider form the default Horizontal -->
                            <Trigger Property="Orientation" Value="Vertical">
                                <Setter Property="LayoutTransform" TargetName="GridRoot">
                                    <Setter.Value>
                                        <RotateTransform Angle="-90"/>
                                    </Setter.Value>
                                </Setter>
                                <!-- Track rotates itself based on orientation so need to force it back -->
                                <Setter TargetName="PART_Track" Property="Orientation" Value="Horizontal"/>
                            </Trigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Key="LogoToPlay">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Logo">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="titleTextBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.45" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="trackSlider">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.714" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="artistTextBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.601" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="currentTime">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.712" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="timeLeft">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.712" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="Logo">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Logo">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="titleTextBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="trackSlider">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="artistTextBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="currentTime">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="timeLeft">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="PlayToLogo">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="titleTextBox">
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="trackSlider">
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="artistTextBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="currentTime">
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="timeLeft">
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Logo">
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2.2" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource Logo}"/>
        </EventTrigger>
    </UserControl.Triggers>

    <Grid x:Name="LayoutRoot">
        <Rectangle RadiusX="8" RadiusY="8">
            <Rectangle.Stroke>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF6B6D5F" Offset="0"/>
                    <GradientStop Color="#FFA99997" Offset="1"/>
                    <GradientStop Color="#FF939785" Offset="0.056"/>
                </LinearGradientBrush>
            </Rectangle.Stroke>
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFEDF0E1" Offset="0"/>
                    <GradientStop Color="#FFF3F4E0" Offset="1"/>
                    <GradientStop Color="#FFE7EAD5" Offset="0.5"/>
                    <GradientStop Color="#FFDFE3C7" Offset="0.51"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Image x:Name="Logo" Margin="0" Source="smallTransparent.png" Stretch="None" StretchDirection="UpOnly" HorizontalAlignment="Center" VerticalAlignment="Center" Width="18" Height="36" Opacity="0"/>
        <TextBlock x:Name="titleTextBox" Height="16" Margin="8,4,8,0" TextWrapping="Wrap" Text="Yellow Submarine" VerticalAlignment="Top" HorizontalAlignment="Center" FontFamily="/MusicBarProba;component/Fonts/#Lucida Grande" Foreground="{DynamicResource TextForegoundColor}" FontWeight="Bold" Width="389.564" TextAlignment="Center"/>
        <Slider Height="13.04" Margin="43.668,0,43.999,4" Style="{DynamicResource SliderStyle}" VerticalAlignment="Bottom" ValueChanged="Slider_ValueChanged" Name="trackSlider" />
        <TextBlock x:Name="artistTextBox" Margin="8,20" TextWrapping="Wrap" Text="Beatles" HorizontalAlignment="Center" FontFamily="/MusicBarProba;component/Fonts/#Lucida Grande" FontSize="10.667" Width="386.156" TextAlignment="Center"/>
        <TextBlock x:Name="currentTime" HorizontalAlignment="Left" Height="12.04" Margin="9,0,0,5" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="30.668" FontFamily="/MusicBarProba;component/Fonts/#Lucida Grande" FontSize="9.333" RenderTransformOrigin="0.614,0.446" TextAlignment="Center"><Run Language="hu-hu" Text="0:39"/><LineBreak/><Run Language="hu-hu"/></TextBlock>
        <TextBlock x:Name="timeLeft" HorizontalAlignment="Right" Height="12.04" Margin="0,36,4.422,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="35.577" FontFamily="/MusicBarProba;component/Fonts/#Lucida Grande" FontSize="9.333" RenderTransformOrigin="20.053,0.169" Text="-2:55" TextAlignment="Center"/>
    </Grid>
</UserControl>